<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout}">

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>

    <title th:text="#{cas.login.pagetitle}">Passwordless Selection Menu View</title>
    <link href="../../static/css/cas.css" rel="stylesheet" th:remove="tag"/>
</head>

<body>
<main class="container mt-3 mb-3">

    <div layout:fragment="content" class="mdc-card card mdc-card-content w-lg-66 p-4 m-auto">
        <h2 class="card-title" th:utext="#{passwordless.selection.header}">Authentication Selection</h2>
        <p  th:utext="#{passwordless.selection.description}">Select one of the authentication options listed below to proceed.</p>
        <div class="card-text">
            <div class="mdc-layout-grid">
                    <div class="mdc-layout-grid__inner">
                        <div class="mdc-layout-grid__cell d-flex cas-card py-2 pb-2 mdc-elevation--z20"
                             th:if="${passwordlessAccount?.requestPassword}">
                            <form name="fmPassword" id="fmPassword" method="post" th:action="@{/login}">
                                <h4 class="d-flex">
                                    <i class="mdi mdi-form-textbox-password fas fa-laptop me-2" aria-hidden="true"></i>
                                    <span th:utext="#{passwordless.selection.password.header}">Password</span>
                                </h4>
                                <p class="text-justify" th:utext="#{passwordless.selection.password.description}">You can authenticate using your password.</p>
                                <input type="hidden" name="execution" th:value="${flowExecutionKey}" />
                                <input type="hidden" name="selection" value="PASSWORD" />
                                <input type="hidden" name="_eventId" value="submit" />
                            </form>
                            <div class="d-flex justify-content-center align-items-center mt-auto">
                                <button id="btnPassword" onclick="$('#fmPassword').submit();" class="mdc-button mdc-button--raised btn btn-primary mt-auto w-33">
                                    <span class="mdc-button__label" th:utext="#{screen.welcome.button.proceed}">Proceed</span>
                                </button>
                            </div>
                        </div>

                        <div class="mdc-layout-grid__cell d-flex cas-card py-2 pb-2 mdc-elevation--z20" th:if="${passwordlessAuthenticationEnabled}">
                            <form name="fmPasswordlessMfa" id="fmPasswordlessMfa" method="post" th:action="@{/login}">
                                <h4 class="d-flex">
                                    <i class="mdi mdi-newspaper-variant fas fa-laptop me-2" aria-hidden="true"></i>
                                    <span th:utext="#{passwordless.selection.token.header}">Token</span>
                                </h4>
                                <p class="text-justify" th:utext="#{passwordless.selection.token.description}">
                                    You will receive a one-time token, valid for a limited period of time, via
                                email or SMS and you will be asked to enter the code here to proceed.</p>
                                <input type="hidden" name="execution" th:value="${flowExecutionKey}" />
                                <input type="hidden" name="selection" value="TOKEN" />
                                <input type="hidden" name="_eventId" value="submit" />
                            </form>
                            <div class="d-flex justify-content-center align-items-center mt-auto">
                            <button id="btnPasswordlessMfa" onclick="$('#fmPasswordlessMfa').submit();" class="mdc-button mdc-button--raised btn btn-primary mt-auto w-33">
                                <span class="mdc-button__label" th:utext="#{screen.welcome.button.proceed}">Proceed</span>
                            </button>
                            </div>
                        </div>
                        <div class="mdc-layout-grid__cell d-flex cas-card py-2 pb-2 mdc-elevation--z20"
                             th:if="${passwordlessMultifactorAuthenticationAllowed}">
                            <form name="fmMfa" id="fmMfa" method="post" th:action="@{/login}">
                                <h4 class="d-flex">
                                    <i class="mdi mdi-security fas fa-laptop me-2" aria-hidden="true"></i>
                                    <span th:utext="#{passwordless.selection.mfa.header}">Multifactor</span>
                                </h4>
                                <p class="text-justify" th:utext="#{passwordless.selection.mfa.description}">You will be routed to a multifactor authentication flow.</p>
                                <input type="hidden" name="execution" th:value="${flowExecutionKey}" />
                                <input type="hidden" name="selection" value="MFA" />
                                <input type="hidden" name="_eventId" value="submit" />
                            </form>
                            <div class="d-flex justify-content-center align-items-center mt-auto">
                            <button id="btnMfa" onclick="$('#fmMfa').submit();" class="mdc-button mdc-button--raised btn btn-primary mt-auto w-33">
                                <span class="mdc-button__label" th:utext="#{screen.welcome.button.proceed}">Proceed</span>
                            </button>
                            </div>
                        </div>

                        <div class="mdc-layout-grid__cell d-flex cas-card py-2 pb-2 mdc-elevation--z20"
                             th:if="${passwordlessDelegatedAuthenticationAllowed}">
                            <form name="fmDelegation" id="fmDelegation" method="post" th:action="@{/login}">
                                <h4 class="d-flex">
                                    <i class="mdi mdi-laptop fas fa-laptop me-2" aria-hidden="true"></i>
                                    <span th:utext="#{passwordless.selection.delegation.header}">External</span>
                                </h4>
                                <p class="text-justify" th:utext="#{passwordless.selection.delegation.description}">You will be sent to an external identity provider to login.</p>
                                <input type="hidden" name="execution" th:value="${flowExecutionKey}" />
                                <input type="hidden" name="selection" value="DELEGATION" />
                                <input type="hidden" name="_eventId" value="submit" />
                            </form>
                            <div class="d-flex justify-content-center align-items-center mt-auto">
                            <button id="btnDelegation" onclick="$('#fmDelegation').submit();" class="mdc-button mdc-button--raised btn btn-primary mt-auto w-33">
                                <span class="mdc-button__label" th:utext="#{screen.welcome.button.proceed}">Proceed</span>
                            </button>
                            </div>
                        </div>
                    </div>
                </div>
        </div>
    </div>
</main>
</body>

</html>
